package com.hnichr.ump.common.doc.entity;

import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import com.hnichr.ump.common.entity.UmpEntity;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Attach;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.policy.SequencePolicy;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@Table(name = "t_doc_goods")
@Schema(description = "商品表")
public class Goods extends UmpEntity {
	private static final long serialVersionUID = 1103765541065900838L;

	@Id
	@Generator
	@Column(name = "RID", updatable = false)
	@Schema(description = "ID")
	private String id;

	@Column(name = "GOODS_CODE")
	@Schema(description = "商品编码")
	@Generator(policy = SequencePolicy.class)
	private String goods;

	@Column(name = "GOODS_NAME")
	@Schema(description = "商品名称")
	private String goodsName;

	@Column(name = "GOODS_TYPE")
	@Dict(dicCode = "id", dicEntity = GoodsType.class, dicText = "typeName")
	@Schema(description = "所属分类")
	private String goodsType;

	@Column(name = "PRICE")
	@Schema(description = "价格")
	private BigDecimal price;

	@Column(name = "SALES_NUM")
	@Schema(description = "销量")
	private Integer salesNum;

	@Column(name = "CONTACTS")
	@Schema(description = "联系人")
	private String contacts;

	@Column(name = "PHONE")
	@Schema(description = "联系电话")
	private String phone;

	@Column(name = "PICS")
	@Schema(description = "轮播图片")
	@Attach
	private String pics;

	@Column(name = "DETAIL_PICS")
	@Schema(description = "详情图片")
	@Attach
	private String detailPics;

	@Column(name = "HOME_FLAG")
	@Schema(description = "首页显示")
	@Dict(dicCode = "sys_flag")
	private String homeFlag;

	@Column(name = "ONLINE_FLAG")
	@Schema(description = "上架标识")
	@Dict(dicCode = "onlineStat")
	private String onlineFlag;

	@Column(name = "VALID_FLAG", length = 2)
	@Schema(description = "有效标识")
	private String validFlag;
}
